import Vue from "vue";
import App from "./App.vue";
import router from "./router";
// 引入全局css样式控制文件
import "./assets/css/global.css";

// 引入和注册elementUI组件库
import ElementUI from "element-ui";
Vue.use(ElementUI);

// 引入图标库样式文件
import "./assets/fonts/iconfont.css";

// 引入axios并配置
import axios from "axios";
// 给axios配置请求拦截器
axios.interceptors.request.use(
  function(config) {
    var token = window.sessionStorage.getItem("token");
    config.headers.Authorization = token;
    return config;
  },
  function(error) {
    return Promise.reject(error);
  }
);
axios.defaults.baseURL = "http://127.0.0.1:11333/api/private/v1/";
// 给axios配置成为Vue的成员
Vue.prototype.$http = axios;
Vue.config.productionTip = false;

new Vue({
  router,
  render: h => h(App)
}).$mount("#app");
